<template>
  <grid title="首页">
    <el-card>
      <div slot="header"
           class="home-slot-header">
        <h4 class="home-solt-title">数据概况</h4>
        <el-badge :value="badge.comment"
                  class="item">
          <el-button size="small">评论</el-button>
        </el-badge>
        <el-badge :value="badge.reply"
                  class="item"
                  type="warning">
          <el-button size="small">回复</el-button>
        </el-badge>
        <el-badge :value="badge.approve"
                  class="item"
                  type="primary">
          <el-button size="small">点赞</el-button>
        </el-badge>
        <el-badge :value="badge.user"
                  class="item"
                  type="success">
          <el-button size="small">用户</el-button>
        </el-badge>
      </div>
      <el-card class="box-card">
        <div slot="header"
             class="clearfix">
          <span>文章数</span>
          <router-link class="link"
                       :to="{
              name: 'topic',
            }">
            查看
          </router-link>
        </div>
        <div class="num">
          共<span class="all">20</span>条数据，其中显示<span class="show">15</span>篇，隐藏<span class="hidden">5</span>篇
        </div>
      </el-card>
      <el-card class="box-card">
        <div slot="header"
             class="clearfix">
          <span>评论数</span>
          <router-link class="link"
                       :to="{
              name: 'comment',
            }">
            查看
          </router-link>
        </div>
        <div class="num">
          共<span class="all">20</span>条数据，其中显示<span class="show">15</span>篇，隐藏<span class="hidden">5</span>篇
        </div>
      </el-card>
    </el-card>
  </grid>
</template>

<script>
export default {
  title: '首页',
  data () {
    return {
      badge: {
        comment: 10,
        reply: 20,
        approve: 99,
        user: 30
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.home-slot-header {
  text-align: right;
  position: relative;
  .home-solt-title {
    position: absolute;
    left: 0;
    top: 0;
    margin: 6px;
  }
  .item {
    margin-left: 20px;
  }
}
.box-card {
  width: 45%;
  margin: 20px 2%;
  display: inline-block;
}
.clearfix {
  display: flex;
  justify-content: space-between;
}

.num > span {
  padding: 0 5px;
}
.all {
  color: #7d7dff;
}
.show {
  color: #28ff28;
}
.hidden {
  color: #f75000;
}
.link {
  float: right;
  padding: 3px 0;
  text-decoration: none;
  color: #409eff;
}
</style>
